package com.javase.A04;

public class Example33 {
    public static void main(String[] args) {
        double suma,sumb,sumc,allSum;
        int[][] arr = new int[3][];
        arr[0] = new int[]{11, 12};
        arr[1]=new int[]{21,22,23};
        arr[2] = new int[]{31, 32, 33, 34};
        suma = sum(arr[0]);
        sumb = sum(arr[1]);
        sumc = sum(arr[2]);
        allSum = suma + sumb + sumc;
        System.out.println("第一小组销售额为："+suma+"万元");
        System.out.println("第二小组销售额为："+sumb+"万元");
        System.out.println("第三小组销售额为："+sumc+"万元");
        System.out.println("总销售额为："+allSum+"万元");
    }

    public static double sum(int[] arr){
        double sum=0;
        for (int i = 0; i < arr.length; i++) {
            sum += arr[i];
        }
        return sum;
    }

}
